package test1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-11-10
 * Time: 16:34
 */
public class Person {
    public int age;             //声明公共字段age
    private String name;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void eat()           //定义无参数的eat方法
    {
        System.out.println(
                "会生活"
        );
    }
    public void work(String s)   //定义带参数的work方法
    {
        System.out.println("努力创造"+s);
    }
    public Person(int age, String name) //定义一个带参数构造函数
    {
        this.age = age;
        this.name = name;
    }

}
